<script lang="ts" setup>
import { onLaunch,onShow } from '@dcloudio/uni-app';
onLaunch(() => {
	initSetting()
});
 onShow(() => {
 	updateVersion()
 });
const initSetting = () => {
	// 微信获取授权
	// #ifdef MP-WEIXIN
	uni.getSetting({
		success(res) {
			if (!res.authSetting['scope.userLocation']) {
				// 地理位置
				uni.authorize({
					scope: 'scope.userLocation'
				});
			}
		}
	});
	// #endif
};

 const updateVersion = ()=>{
	 // #ifdef MP-WEIXIN
	 const updateManager = wx.getUpdateManager()
	 updateManager.onUpdateReady(function () {
	   wx.showModal({
	     title: '更新提示',
	     content: '新版本已经准备好，是否重启应用？',
	     success: function (res) {
	       if (res.confirm) {
	         // 新的版本已经下载好，调用 applyUpdate 应用新版本并重启
	         updateManager.applyUpdate()
	       }
	     }
	   })
	 })
	 // #endif
 }
</script>

<style lang="scss">
/*每个页面公共css */
@import "@/static/iconfont.css";
@import "@/styles/app.scss";
.parent {
	min-height:100vh;
	padding: 15px;
	position: relative;
}
</style>
